import sm2 from './sm-crypto/sm2/index'
export default {
	doEncrypt(consumerId, publicKey) {
		// var m2 = require("sm-crypto").sm2
		// 加密
		let cipherMode = 1; // 1 - C1C3C2，0 - C1C2C3，默认为1
		let encryptData = sm2.doEncrypt(consumerId, publicKey, cipherMode); // 加密结果
		return encryptData;
	},
	randomString(length) {
		//随机数
		let str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		let result = "";
		for (let i = length; i > 0; --i) result += str[Math.floor(Math.random() * str.length)];
		return result;
	}
};
